#ifndef MUTEXIMP_HPP
#define MUTEXIMP_HPP

// This guard ensures that POSIX implementation is used only
// on unix platform.
#ifndef MY_USE_UNIX

    #error POSIX version of __FILE__ is used without MY_USE_UNIX defined.

#endif

#include <pthread.h>
#include <stdint.h>

#include "Pattern/Uncopyable.hpp"

namespace My
{
    class MutexImp : private Uncopyable
    {
    public:
        void Lock();
        bool TryLock();
        void Unlock();

    protected:
        MutexImp(bool is_recursive = false);
        ~MutexImp();

    private:
        #ifdef MY_USE_DEBUG

            bool m_Recursive;
            uint32_t m_Locks;

        #endif

        pthread_mutex_t m_Mutex;
    };
}

#endif // MUTEXIMP_HPP
